package com.vijos;

//记数问题
public class P1_1_1848 {
    public static int test(int n, int x) {
        int count = 0;
        while (n != 0) {
            if (n % 10 == x) {
                count++;
            }
            n /= 10;
        }
        return count;
    }
    public static void main(String[] args) {
        System.out.println(test(111, 1) == 3);
        System.out.println(test(12121, 1) == 3);
        System.out.println(test(12121, 2) == 2);
    }
}
